Issue diagnostics if xm is being run as a non-root user. This used to happen,
authoremellor@ewan <emellor@ewan>
Wed, 12 Oct 2005 09:07:04 +0000 (10:07 +0100)
committeremellor@ewan <emellor@ewan>
Wed, 12 Oct 2005 09:07:04 +0000 (10:07 +0100)
but the triggering error has moved, so the diagnostics were broken.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xm/main.py

index 082bdb636725c7270109b9207b8225db20fb93a1..11e2ff71944f4e940627f9e9a8b9a77bc6af3a14 100644 (file)
@@ -688,11 +688,16 @@ def main(argv=sys.argv):
             if rc:
                 usage()
         except socket.error, ex:
-            print >>sys.stderr, ex
-            err("Error connecting to xend, is xend running?")
+            if os.geteuid() != 0:
+                err("Most commands need root access.  Please try again as root.")
+            else:
+                err("Error connecting to xend: %s.  Is xend running?" % ex[1])
             sys.exit(1)
         except IOError:
-            err("Most commands need root access.  Please try again as root")
+            if os.geteuid() != 0:
+                err("Most commands need root access.  Please try again as root.")
+            else:
+                err("Error connecting to xend: %s." % ex[1])
             sys.exit(1)
         except xen.xend.XendError.XendError, ex:
             if len(args) > 0: